package com.inspur.security.cbb3.kms.keyusage.data.repository;

import com.inspur.security.cbb3.kms.keyusage.data.po.DataBean;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

public interface DataRepository extends JpaRepository<DataBean, String>, JpaSpecificationExecutor<DataBean> {

    /**
     * 更新计算后的数据
     * @param resultData 计算后的数据
     * @param uuid uuid
     * @param resultDataContentEncoding 计算后的数据格式
     */
    @Transactional
    @Modifying
    @Query(value = "update DataBean db set db.resultData=?1, db.resultDataContentEncoding=?2 where db.uuid=?3")
    void updataResultData(String resultData, String resultDataContentEncoding, String uuid);

}
